import numpy as np
import matplotlib.pyplot as plt

# 创建一个从0到360度的角度数组
theta = np.linspace(0, 360, 1000)
theta_o = np.linspace(0, 0, 1000)
# 将角度转换为弧度
theta_rad = np.radians(theta)

# 计算sin和cos值
sin_theta = np.sin(theta_rad)
cos_theta = np.cos(theta_rad)
loss_theta = (np.cos(theta_rad)-np.cos(theta_o))**2 + (np.sin(theta_rad)-np.sin(theta_o))**2
# 创建图形
plt.figure(figsize=(10, 5))

# 绘制sin曲线
plt.plot(theta, sin_theta, label='sin(theta)', color='blue')

# 绘制cos曲线
plt.plot(theta, cos_theta, label='cos(theta)', color='red')

plt.plot(theta, loss_theta, label='loss_theta', color='green')
# 添加标题和标签
plt.title('Sin and Cos Functions from 0 to 360 Degrees')
plt.xlabel('Theta (degrees)')
plt.ylabel('Value')

# 添加图例
plt.legend()

# 显示网格
plt.grid(True)

# 显示图形
plt.show()

